package com.axzh.interview.test;

import java.io.IOException;
import java.io.ObjectOutputStream;
import java.io.Serializable;

public class Favorites implements Serializable {

	/**
	 * serial ID
	 */
	private static final long serialVersionUID = -7527371396446297019L;
	
	/*private Map<Class<?>,Object> map = new HashMap<>();
	
	public <T> void putFavorite(Class<T> type, T instance) {
		if(type==null) {
			throw new NullPointerException();
		}
		map.put(type, type.cast(instance));
	}
	
	public <T> T getFavorite(Class<T> type) {
		return type.cast(map.get(type));
	}*/
	
	/**
	 * Serialize this {@code Favorites} instance
	 * @serialData The size of the list is emitted, flowed by all of its elements 
	 * @param s
	 */
	private void writeObject(ObjectOutputStream s) {
		try {
			s.defaultWriteObject();
			s.writeInt(0);
			s.writeObject(null);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	
}
